<include file="Index/header" />

<div class="container">
	<nav class="navbar navbar-default" role="navigation">
		<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
			<ul class="nav navbar-nav">
				<li>
					<a href="?m=admin&c=goods&a=index" class="glyphicon glyphicon-arrow-right">返 回</a>
				</li>
			</ul>
			<form class="navbar-form navbar-right" action="?m=admin&c=goods&a=query" method="post" role="search">
				<div class="form-group">
					<input type="text" class="form-control" placeholder="商品名称" id="gn" name="gn" />
				</div> <button type="submit" class="btn btn-default">搜索</button>
			</form>
		</div>
	</nav>
	<form action="?m=admin&c=goods&a=addImg" method="post" enctype="multipart/form-data" onsubmit="return checkFile()"
		style="margin: 0 auto; width: 30%;">
		<h3>商品{$goods_id}添加图片</h3>
		<div class="form-group">
			<label for="exampleInputEmail1">当前图片：</label>
			<img class="img-rounded" src="__PUBLIC__/images/goods/{$pic_url}" width="300px" height="300px" alt="">
		</div>
		<div class="form-group">
			<label for="exampleInputFile">更新图片</label>
			<input type='file' name='pic_url' id='img_file'>
			<input type='hidden' value='{$goods_id}' name="goods_id">
		</div>
		<button type="submit" class="btn btn-default btn-block">提交</button>
	</form>

	<br />
	<br />
</div>
<script type="text/javascript">
	function checkFile() {

		var file = document.getElementById('img_file').value
		if (file == '') {
			alert("你尚未选择图片！");
			return false;
		}
		return true;
	}

	function query() {
		var name = document.getElementById('gn').value;
		if (name == '') {
			alert("查询商品名称不能为空!");
			return false;
		}
		return true;
	}
</script>

<include file="Index/footer" />